package com._23DesignPattern._structure._proxy.DynamicProxy.other;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author: huangya
 * @Date: 2019/3/10
 * @Description:
 */
public class LogHandler implements InvocationHandler {
     private Object targetObject;

    public LogHandler(Object targetObject) {
        this.targetObject = targetObject;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before..");
        Object obj = method.invoke(targetObject, args);
        System.out.println("after..");
        return obj;
    }
}
